<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:cc="http://java.sun.com/jsf/composite">

    <h:head>
		<title>This content will not be displayed</title>
    </h:head>

    <h:body>

		<cc:interface>
		    <cc:attribute name="tableId" required="true" />
		    <!-- required=true causes a bug since GF v3.1 because data retrieval method is not yet called when component
		    		is created (with f:event): JAVASERVERFACES-1922
		    		http://stackoverflow.com/questions/4089076/glassfish-3-1-b-25-weird-form-error-the-form-component-needs-to-have-a-uiform-i
		    		http://code.google.com/p/primefaces/issues/detail?id=1586 -->
		    <cc:attribute name="value" />
		    <cc:attribute name="listSize" required="true" />
		</cc:interface>
	
		<cc:implementation>
	
		    <div class="dataTable">
				<p:dataTable id="#{cc.attrs.tableId}" styleClass="dcListe"
					     value="#{cc.attrs.value}" var="rq" rows="#{cc.attrs.listSize}"
					     paginator="true" paginatorPosition="bottom">
				    
				    <p:column sortBy="#{rq.clientReference}">
						<f:facet name="header"><h:outputText value="#{msg.dclListeReference}" /></f:facet>
						<h:outputText value="#{rq.clientReference}" />
				    </p:column>
				    
				    <p:column sortBy="#{rq.requestType}">
						<f:facet name="header"><h:outputText value="#{msg.dclListeTypeDC}" /></f:facet>
						<h:outputText value="#{rq.requestType}" />
				    </p:column>
					
					<p:column sortBy="#{rq.modificationDate}">
						<f:facet name="header"><h:outputText value="#{msg.dclListeLastModifDate}" /></f:facet>
						<h:outputText value="#{rq.modificationDate}">
					    	<f:convertDateTime dateStyle="short" timeStyle="medium" type="both" />
						</h:outputText>
				    </p:column>
				    
				    <p:column sortBy="#{rq.title}">
						<f:facet name="header"><h:outputText value="#{msg.dclListeObject}" /></f:facet>
						<h:outputText value="#{rq.title}" />
				    </p:column>
				    
				    <p:column sortBy="#{rq.clientStatus}">
						<f:facet name="header"><h:outputText value="#{msg.dclListeStatutClient}" /></f:facet>
						<h:outputText value="#{rq.clientStatus}" />
				    </p:column>
				    
				    <p:column sortBy="#{rq.internalStatus}">
						<f:facet name="header"><h:outputText value="#{msg.dclListeStatutAtos}" /></f:facet>
						<h:outputText value="#{rq.internalStatus}" />
				    </p:column>
		
				    <!-- additional columns if needed -->
				    <ui:insert />
		
				    <p:column>
						<f:facet name="header"><h:outputText value="#{msg.dclListeDetails}" /></f:facet>
						<h:commandButton value="#{msg.dclListeDetails}" action="REQ_DETAILS" styleClass="button">
						    <f:setPropertyActionListener target="#{requestDetailsPage.clientRequest}" value="#{rq}"/>
						</h:commandButton>
				    </p:column>
				</p:dataTable>
		    </div>
	
		</cc:implementation>

    </h:body>
</html>